<?php
/**
* @author: Nguyen Thanh Tung
* @date: Friday, January 24, 2014
*/
/*if( !isset($AppUI->id)||
!isset($_SESSION['stadium'])||
isset($_SESSION['stadium'])&&($_SESSION['stadium']&1<<0)==0)
 {
	redirect(HOST_BACKEND);
}


$intTotal      = 0;
$intPage       = (int)$this->input->get('page', 1);
$intCancel	   = (int)$this->input->get('pcancel', 0);
$intLimit      = 20;
$intOffset     = ($intPage-1)*$intLimit;
$intStatus     = (int)$this->input->get('stt','-1');
$strKeyword    = $this->input->get('pkeyword',null);
$strStartDate  = $this->input->get('startdate',null);
$strEndDate    = $this->input->get('enddate',null);
$intClubId     = (int)$this->input->get('id',0);
$intOption 	   = (int)$this->input->get('option',0);
//kiem tra dateStart va dateEnd
if($strStartDate != '' || $strEndDate != ''||$intStatus!=-1) {	
	$_SESSION['STADIUM_CANCEL'] 	= 1;	
	$_SESSION['STADIUM_SEARCH']	= $this->input->get();
}elseif($intOption!=''||$intStatus!=-1){ //kiem tra OptionSearch
	$_SESSION['STADIUM_CANCEL'] 	= 1;	
	$_SESSION['STADIUM_SEARCH']	= $this->input->get();
}
elseif(trim($strKeyword)!=''||$intStatus!=-1){ //kiem tra Keyword
	$_SESSION['STADIUM_CANCEL'] 	= 1;	
	$_SESSION['STADIUM_SEARCH']	= $this->input->get();
}
else {	
	if(isset($_SESSION['STADIUM_SEARCH'])) unset($_SESSION['STADIUM_SEARCH']);
	if(isset($_SESSION['STADIUM_CANCEL'])) unset($_SESSION['STADIUM_CANCEL']);
    $strStartDate = '';
    $strEndDate = '';
	$intOption = 0;
	$strKeyword = '';
	$intStatus = -1;
}

if($intCancel) {
	if(isset($_SESSION['STADIUM_SEARCH'])) unset($_SESSION['STADIUM_SEARCH']);
	if(isset($_SESSION['STADIUM_CANCEL'])) unset($_SESSION['STADIUM_CANCEL']);
    $strStartDate = '';
    $strEndDate = '';
	$intOption = 0;
	$strKeyword = '';
	$intStatus = -1;
}

$this->load->model('stadium_model', 'stadium');
$arrResult	= $this->stadium->getAll($AppUI->id,$intStatus,$intClubId,$intOption,$strKeyword,$strStartDate,$strEndDate,$intOffset, $intLimit, $intTotal);
$this->smarty->assign('arrResult',  $arrResult);
$this->smarty->assign('intTotal',   $intTotal);
$this->smarty->assign('intOffset',  $intOffset);
$this->smarty->assign('intLimit',   $intLimit);*/
$this->smarty->display('league/index.tpl');